 //
//  MomentsToolBarView.m
//  AnimationRecommend
//
//  Created by 花花蔡 on 2017/2/22.
//  Copyright © 2017年 ljm. All rights reserved.
//

#import "MomentsToolBarView.h"

@interface MomentsToolBarView ()

@property(nonatomic,strong) UIButton *likeBtn;
@property(nonatomic,strong) UIButton *commentBtn;


@end

@implementation MomentsToolBarView

- (instancetype)initWithFrame:(CGRect)frame {
    
    if (self = [super initWithFrame:frame]) {
        //添加子控件
        [self setChildView];
        self.layer.cornerRadius = 7.0;
        self.layer.masksToBounds = NO;
        
    }
    return self;
}

- (instancetype)initWithBtnClicked:(ButtomClickedWithSender)sender {
    if (self = [super init]) {
        if (sender) self.likeBtnBlock = sender;
    }
    
    return self;
}

- (void)setChildView {
    self.backgroundColor = [UIColor colorWithHexString:@"#555555"];
    //点赞
    _likeBtn = [[UIButton alloc] init];
    [_likeBtn setImage:[UIImage imageNamed:@"heart-2"] forState:UIControlStateNormal];
    //    [likeBtn setBackgroundImage:[UIImage imageNamed:@"bg"] forState:UIControlStateNormal];
    [_likeBtn setTitleColor:circleCellToolBarTintColor forState:UIControlStateNormal];
    _likeBtn.titleLabel.font = circleCellToolBarTittleFont;
    _likeBtn.tag = 1001;
    [_likeBtn addTarget:self action:@selector(btnClicked:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:_likeBtn];
    
    //评论
    _commentBtn = [[UIButton alloc] init];
    _commentBtn.tag = 1002;
    [_commentBtn setImage:[UIImage imageNamed:@"chat-2"] forState:UIControlStateNormal];
    [_commentBtn setTitleColor:circleCellToolBarTintColor forState:UIControlStateNormal];
    _commentBtn.titleLabel.font = circleCellToolBarTittleFont;
    [_commentBtn addTarget:self action:@selector(btnClicked:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:_commentBtn];
}

-(void)setMomentFrames:(MomentsViewModel *)momentFrames {
    
    self.likeBtn.frame = momentFrames.toolLikeFrame;
    self.commentBtn.frame = momentFrames.toolCommentFrame;
}

- (void)btnClicked:(UIButton *)btn {
    self.likeBtnBlock(btn);
}

@end
